home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / iconal1a / module1.bas < prev    next >
BASIC Source File  |  1999-10-04  |  1KB  |  30 lines

  1. Attribute VB_Name = "Module1"
  2. Public xx%, Idx%, IconIdx%
  3. Public Temp$, IBpath$, inp$, Mess$
  4.  
  5. Public Sub ColForm(Obj As Object, R%, G%, B%, Step%)
  6. Dim R1%, G1%, B1%, R2%, G2%, B2%
  7. 'Best effect with borderstyle = 0
  8. 'Obj   = Form or Picture-box
  9. 'R%    = color for red-component
  10. 'G%    = color for green-component
  11. 'B%    = color for blue-component
  12. 'Step% = the step to darken and lighten the border
  13. Obj.ScaleMode = 3 'pixels
  14. Obj.AutoRedraw = True 'very important !
  15. Obj.BackColor = RGB(R%, G%, B%)
  16. R1% = R% + Step%: If R1% > 255 Then R1% = 255
  17. G1% = G% + Step%: If G1% > 255 Then G1% = 255
  18. B1% = B% + Step%: If B1% > 255 Then B1% = 255
  19. R2% = R% - Step%: If R2% < 0 Then R2% = 0
  20. G2% = G% - Step%: If G2% < 0 Then G2% = 0
  21. B2% = B% - Step%: If B2% < 0 Then B2% = 0
  22. Obj.Line (2, 2)-(Obj.ScaleWidth - 2, Obj.ScaleHeight - 2), RGB(R1%, G1%, B1%), B
  23. Obj.Line (Obj.ScaleWidth - 2, 2)-(Obj.ScaleWidth - 2, Obj.ScaleHeight - 1), RGB(R2%, G2%, B2%)
  24. Obj.Line (1, Obj.ScaleHeight - 2)-(Obj.ScaleWidth - 2, Obj.ScaleHeight - 2), RGB(R2%, G2%, B2%)
  25. Obj.Line (5, 5)-(Obj.ScaleWidth - 5, Obj.ScaleHeight - 5), RGB(R2%, G2%, B2%), B
  26. Obj.Line (Obj.ScaleWidth - 5, 6)-(Obj.ScaleWidth - 5, Obj.ScaleHeight - 4), RGB(R1%, G1%, B1%)
  27. Obj.Line (5, Obj.ScaleHeight - 5)-(Obj.ScaleWidth - 5, Obj.ScaleHeight - 5), RGB(R1%, G1%, B1%)
  28. End Sub
  29.  
  30.